package com.idis.dbApp.controller;

import com.idis.dbApp.mapper.ContactMapper;
import com.idis.entity.Contact;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import io.swagger.annotations.ApiResponses;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * Created by Ming on 2018/2/7.
 */

/**
 * 联系方式Api
 */
@RestController
@RequestMapping("/contact")
@Api(tags = "联系方式接口")
public class ContactController {

    @Autowired
    ContactMapper contactMapper;

    @ApiOperation("获取联系方式")
    @GetMapping("/all")
    public List<Contact> findIntro(){
        return contactMapper.findAll();
    }

    @ApiOperation("更新联系方式")
    @PostMapping("/update")
    public Integer update(@ApiParam(value = "联系方式对象,picture为图像的URL")@RequestBody Contact contact){
        return contactMapper.updateByPrimaryKey(contact);
    }

}
